<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('图纸设备查看')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>系统：</p>
                                <input type="text" name="system"/>
                            </li>
                            <li>
                                <p>子项：</p>
                                <input type="text" name="subitem"/>
                            </li>
                            <li>
                                <p>文件编码：</p>
                                <input type="text" name="fileCode"/>
                            </li>
                            <li>
                                <p>文件名称：</p>
                                <input type="text" name="fileName"/>
                            </li>
                            <li>
                                <p>版本：</p>
                                <input type="text" name="version"/>
                            </li>
                            <li>
                                <p>版次：</p>
                                <input type="text" name="edition"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('dxfcomponent:dxf:edit')}]];
        var searchFlag = [[${@permission.hasPermi('dxfcomponent:dxf:search')}]];
        var removeFlag = [[${@permission.hasPermi('dxfcomponent:dxf:remove')}]];
        var prefix = ctx + "dxfcomponent/dxf";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                searchUrl: prefix + "/search/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "dxf文件索引信息",
                columns: [
                // {
                //     checkbox: true
                // },
                {
                    title: "序号",
                    //width : '30%',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field : 'drawId', 
                    title : 'null',
                    visible: false
                },
                {
                    field : 'fileCode', 
                    title : '文件编码'
                },
                {
                    field : 'fileName', 
                    title : '文件名称'
                },
                {
                    field : 'version', 
                    title : '版本'
                },
                {
                    field : 'edition', 
                    title : '版次'
                },
                {
                    field : 'system', 
                    title : '系统'
                },
                {
                    field : 'subitem', 
                    title : '子项'
                },
                {
                    field : 'remark', 
                    title : '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + searchFlag + '" href="javascript:void(0)" onclick="searchDraw(\'' + row.drawId + '\')"><i class="fa fa-edit"></i>查看图纸</a> ');
                        // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.drawId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.drawId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function searchDraw(id) {

            var equipment = prefix + "/search?drawId=" + id;
            var img = prefix + "/view?drawId=" + id;
            if($.common.isEmpty(id) && table.options.type == table_type.bootstrapTreeTable) {
                var row = $("#" + table.options.id).bootstrapTreeTable('getSelections')[0];
                if ($.common.isEmpty(row)) {
                    $.modal.alertWarning("请至少选择一条记录");
                    return;
                }
                var url = table.options.searchUrl.replace("{id}", row[table.options.uniqueId]);
                window.open (img);
                window.open (equipment);
            } else {
                window.open (img);
                window.open (equipment);
            }
        }

    </script>
</body>
</html>